<template>
  <div>
    <el-card class="box-card">
      <el-table
        border
        :data="tableData"
        style="width: 100%">
        <el-table-column
          type="index"
          width="50">
        </el-table-column>
        <el-table-column
          prop="name"
          label="姓名"
          width="180">
        </el-table-column>
        <el-table-column
          prop="cip"
          label="ip地址">
        </el-table-column>
        <el-table-column
          prop="cname"
          label="访问地区">
        </el-table-column>
        <el-table-column
          prop="cid"
          label="地区邮编号">
        </el-table-column>
        <el-table-column
          prop="add_time"
          label="日期"
          :formatter="dateFormat"
          width="180">
        </el-table-column>
      </el-table>
    </el-card>
  </div>
</template>

<script>
import {getUserInformationList} from './api/api'

export default {
  data() {
    return {
      tableData: []
    }
  },
  methods: {
    dateFormat(row, column) {
      var date = new Date(row.add_time*1000) //时间戳为10位需*1000，时间戳为13位的话不需乘1000
      var Y = date.getFullYear() + '-'
      var M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-'
      var D = date.getDate() + ' '
      var h = date.getHours() + ':'
      var m = date.getMinutes() + ':'
      var s = date.getSeconds()
      return Y+M+D+h+m+s
    }
  },
  created() {
    getUserInformationList().then(x => {
      this.tableData = x.data
    })
  }
}
</script>

<style scoped>

</style>
